package com.codyy.lib.base.application

import android.app.Application
import android.content.ContextWrapper
import com.codyy.lib.base.application.di.appModule
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidFileProperties
import org.koin.core.context.startKoin

lateinit var mApplication: Application

class App : Application() {

    override fun onCreate() {
        super.onCreate()
        mApplication = this
        startKoin {
            androidContext(this@App)
            androidFileProperties()//load properties from assets/koin.properties file
            modules(appModule)
        }
    }
}

object AppContext : ContextWrapper(mApplication)//ContextWrapper对Context上下文进行包装(装饰者模式)